package com.rjt.common.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.rjt.common.util.TextUtil;

/**  

* <p>Title: Indexontroller.java</p>  

* <p>Description: </p>  

* @author renjiangtao 

* @date 2018年7月18日  

* @version 1.0  

*/
@Controller
public class Indexontroller {
	private Logger logger = LoggerFactory.getLogger(Indexontroller.class);
	
	private int total=0;
	@GetMapping("/")
	public String index(HttpServletRequest request){
		logger.warn("ip:{} zhu主页", TextUtil.getRemortIP(request));
		return "index";
	}
	
	@GetMapping("/test")
	@ResponseBody
	public String test(HttpServletRequest request){
		total=total+1;
		return "{\"total\":"+total+"}";
	}	
}
